package com.boom.monitor.service;

import com.boom.common.utils.uuid.IdUtils;
import com.boom.monitor.domain.MonitorConfig;
import com.boom.monitor.mapper.MonitorConfigMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author:yzw
 * @Date:2021/3/23 上午10:13
 * @desc: 配置信息
 * @version:1.0
 */
@Service
public class BoomConfigService {

	@Resource
	private MonitorConfigMapper monitorConfigMapper;

	/**
	 * 查询配置
	 *
	 * @param id 配置ID
	 * @return 配置
	 */
	public MonitorConfig selectMonitorConfigById(String id) {
		return monitorConfigMapper.selectMonitorConfigById(id);
	}

	/**
	 * 查询配置列表
	 *
	 * @param monitorConfig 配置
	 * @return 配置
	 */
	public List<MonitorConfig> selectMonitorConfigList(MonitorConfig monitorConfig) {
		return monitorConfigMapper.selectMonitorConfigList(monitorConfig);
	}

	/**
	 * 新增配置
	 *
	 * @param monitorConfig 配置
	 * @return 结果
	 */
	public int insertMonitorConfig(MonitorConfig monitorConfig) {
		monitorConfig.setId(IdUtils.simpleUUID());
		return monitorConfigMapper.insertMonitorConfig(monitorConfig);
	}

	/**
	 * 修改配置
	 *
	 * @param monitorConfig 配置
	 * @return 结果
	 */
	public int updateMonitorConfig(MonitorConfig monitorConfig) {
		return monitorConfigMapper.updateMonitorConfig(monitorConfig);
	}

	/**
	 * 批量删除配置
	 *
	 * @param ids 需要删除的配置ID
	 * @return 结果
	 */
	public int deleteMonitorConfigByIds(String[] ids) {
		return monitorConfigMapper.deleteMonitorConfigByIds(ids);
	}

	/**
	 * 删除配置信息
	 *
	 * @param id 配置ID
	 * @return 结果
	 */
	public int deleteMonitorConfigById(String id) {
		return monitorConfigMapper.deleteMonitorConfigById(id);
	}
}
